#ifndef POINT_H
#define POINT_H

#include <QtGui>
#include "commons.h"

class Point : public QObject, public QGraphicsEllipseItem
{
    Q_OBJECT
public:
    explicit Point(const QPointF & pos,
                   QGraphicsItem *parent = 0 ,
                   QGraphicsScene *scene = 0,
                   int d = 10);
    Point(const Point& p);
    ~Point();

    void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
    void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
    void mouseMoveEvent(QGraphicsSceneMouseEvent *event);

    void moveTo(const QPointF& dest);

    inline void setState(CanvasState state) {this->state=state;}
    inline CanvasState getState() const {return this->state;}

signals:
    void hoverEntered();
    void hoverLeft();
    void dragStart();
    void dragStop();
    void linerStart(Point* point);
    void pointMoved(Point* point);
    void deletePoint(Point* point);

public slots:

private:
    QGraphicsEllipseItem *circle;
    CanvasState state;
    CanvasState prevState;
    int diameter;

};

#endif // POINT_H
